Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pressing
o
(I'm not tied to this key, its just next top
on the keyboard), now steps the simulation if the simulation is paused and the sim has processed it's next step.This works with a double mutex, whereby
render_buffer_mutex_pre
is locked by the visualiser, prior to lockingrender_buffer_mutex
(the normal pause mutex). After the lock ofrender_buffer_mutex
is achieved, the lock onrender_buffer_mutex_pre
is released.This allows us to quickly release the normal pause mutex, and lock
render_buffer_mutex_pre
, prior to re-locking the normal pause mutex.This (albeit a race) should guarantee the simulation if waiting to lock the pause mutex, only has time to update the buffers and complete one step.
This approach works because, typically the simulation has completed it's next step and is waiting to update render buffers, where the pause mutex blocks it.
The downside of this approach is that it has no impact if the simulation is running slower than the time between your attempts to step the simulation (as the renderer can lock and release
render_buffer_mutex_pre
without any competition from the sim. This could be detected, by checking whetherrender_buffer_mutex_pre
is already locked, and a message shared with the user.Closes #124
First commit is a basic one, that adds alt camera controls with the arrow keys, i keep trying to use them with orthographic view.